<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        #cats li {
            background-color: pink;
            height: 40px;
            line-height: 40px;
            position: relative;
            color: white;
            padding: 10px;
        }
        
        #cats li:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 10px;
            background-color: green;
            /* 变形属性 */
            transform: scaleY(0.5);
        }
    </style>
</head>

<body>
    <ul id="cats"></ul>
    <script>
        const cats = [{
            name: 'Snickers',
            age: 2
        }, {
            name: 'Hugo',
            age: 1
        }, {
            name: 'Suny',
            age: 3
        }];
        const oul = document.querySelector('#cats');

        // for (let cat of cats) {
        //     oul.innerHTML += `
        //    <li>
        //         ${cat.name}---${cat.age}
        //         </li>
        //     `}
        oul.innerHTML = cats.map((cat) =>
            `
            <li>
                    ${cat.name} -- ${cat.age}
</li>
                  `
        ).join('-----')
    </script>
</body>

</html>